#ifndef GAMEMAP_HPP_INCLUDED
#define GAMEMAP_HPP_INCLUDED

#include <string>
#include <vector>

#include "heightmap.hpp"
#include "river.hpp"
#include "tile_fwd.hpp"
#include "tile_logic.hpp"

namespace hex {

class gamemap {
public:
	struct parse_error {};
	explicit gamemap(const std::string& str);
	gamemap(const std::vector<tile_ptr>& tiles, int width, int height);
	void add_river(river_ptr r);
	const_tile_ptr get_tile(const location& loc) const;
	tile_ptr get_tile(const location& loc);
	bool is_loc_on_map(const location& loc) const;

	int width() const { return width_; }
	int height() const { return height_; }

	const std::vector<tile_ptr>& tiles() const { return tiles_; }

	const heightmap& heights() const { return heights_; }
	heightmap& heights() { return heights_; }
	void init_heightmap();

	const std::vector<river_ptr>& rivers() const { return rivers_; }
private:
	int width_, height_;
	std::vector<tile_ptr> tiles_;
	heightmap heights_;
	std::vector<river_ptr> rivers_;
};
}

#endif
